import base64
import cv2


def img2base64(img):
    encoded = cv2.imencode('.jpeg', img)[1]
    return str(base64.b64encode(encoded), encoding="utf-8")
